﻿using UnityEngine;
using WebSocketSharp.Server;

namespace Sliver.Network.WebSocket.Host
{
    public class WebSocketHost
    {
        protected WebSocketServer Host;

        protected WebSocketSharp.WebSocket Sliver;

        public WebSocketHost()
        {
            Host = new WebSocketServer("ws://127.0.0.1:9105");
            Debug.Log("websocket server started!");
            // Host.Log.Output = (data, s) =>
            // {
            //     Debug.Log(data.Message + "\n" + s);
            // };
        }

        public void Start()
        {
            Debug.Log("start websocket host");
            Host.Start();
        }

        public void Stop()
        {
            Host.Stop();
        }

        public void Release()
        {
            Host.Stop();
        }
    }
}